﻿/*M,E,R,F四人参加自行车比赛，分别获得1-4名，且每个人骑不同颜色的自行车（red,purple,blue,green)
线索为下面四条
1.E骑purle，R没有骑green
2.M和E不是第一，也不是最后
3.骑blue的人领先F
4.骑green的人领先骑purpule的人

*/
#include<iostream>
using namespace std;
int red, purple, blue, green;
int M, E, R, F;
int main() {
	for (M = 1; M <= 4; M++) {//M名次
		for (E = 1; E <= 4; E++) {
			for (R = 1; R <= 4; R++) {
				for (F = 1; F <= 4; F++) {
					for (red = 1; red <= 4; red++) {//red色车的名次
						for (blue = 1; blue <= 4; blue++) {
							for (green = 1; green <= 4; green++) {
								for (purple = 1; purple <= 4; purple++) {
									if (M != E && M != R && M != F && E != R && E != F && R != F) {//先满足rank序号不重复
										if (red != purple && red != blue && red != green && purple != blue && purple != green && blue != green) {//再满足color序号不重复
											if ((E==purple)&&(R!=green)&&(M!=1)&&(M!=4)&&(E!=1)&&(E!=4)&&(blue<F)&&(green<purple)){//满足剩余条件
												if (M == 2) { cout << "第二名是:MIKE" << endl; }
												if (E == 2) { cout << "第二名是:ELLIE" << endl; }
												if (R == 2) { cout << "第二名是:ROHAN" << endl; }
												if (F == 2) { cout << "第二名是:FATMA" << endl; }
											}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}

